﻿using FluentNHibernate.Mapping;
using EntitiesAndMappings.Entities;

namespace EntitiesAndMappings.Mappings
{
    public class DetalleSalidaMap : ClassMap<DetalleSalida>
    {
        public DetalleSalidaMap()
        {
            Id(x => x.Id).GeneratedBy.Native();
            References(x => x.Salida).LazyLoad(Laziness.False).Not.Nullable();
            References(x => x.Articulo).LazyLoad(Laziness.False).Not.Nullable();
            Map(x => x.Cantidad).Not.Nullable();
            References(x => x.CondicionEquipo).LazyLoad(Laziness.False).Not.Nullable();
            Map(x => x.Partes).Nullable();
            Map(x => x.Consumibles).Nullable();
            Map(x => x.ObservacionesMantenimiento).Nullable();
            HasMany(x => x.ItemsEntregaEquipo).Inverse().AsBag().Cascade.AllDeleteOrphan(); 
        }       

    }
}
